Find the connected components with DFS